Convert snapshot#8380
Conversation
…utside of VoteState
| }); | ||
| if account.owner == solana_vote_program::id() { | ||
| VoteStateVersions::convert_from_raw(&mut account, pubkey); | ||
| root_bank.store_account_convert(*slot, pubkey, &account); |
There was a problem hiding this comment.
This might work; but I'm unsure what you want to achieve here. This way you can certainly could rewrite serialized vote accounts in snapshot. But this changes the binary (right?) then, account.hash and slot_hash and any future votes and PoH as well. This is a cascading effect. We can technically rewrite those, but we stop here: we can't rewrite third-party's signatures.
So, I think the ledger integrity is compromised. Could you explain why snapshot rewrite is needed nevertheless? :)
There was a problem hiding this comment.
We want to keep the existing TdS ledger state, so all TdSers don't need to restart from genesis. The actual ledger history is ok to compromise on TdS right now 😬
| exit(1); | ||
| }); | ||
|
|
||
| let storages: Vec<_> = root_bank.get_snapshot_storages(); |
There was a problem hiding this comment.
you're very trendy for incorporating (rebasing on) my latest pr: #8339 :p
| } | ||
|
|
||
| pub fn convert_from_raw(account: &mut Account, pubkey: &Pubkey) { | ||
| let vote_state: VoteState0_23_5 = account |
There was a problem hiding this comment.
Reminder: depending on the use case of snapshot rewrite, we must be careful to update account.hash to what its definition should be.
| pub struct CircBuf<I> { | ||
| pub buf: [I; MAX_ITEMS], | ||
| /// next pointer | ||
| pub idx: usize, |
There was a problem hiding this comment.
nits; when serializing explicit bitwidth is preferred? In this case, u64?
| @@ -0,0 +1,60 @@ | |||
| use super::*; | |||
|
|
|||
| const MAX_ITEMS: usize = 32; | |||
There was a problem hiding this comment.
related to this, if these are expected order of numbers, u8 is just enough?
There was a problem hiding this comment.
@ryoqun this is copy-pasted from the old version of the vote state, trying to stay as close to the original as possible.
35d9794 to
0cdf0b3
Compare
b8f79f2 to
c0fe94c
Compare
c0fe94c to
da903bf
Compare
Problem
No method exists to upgrade accounts in old snapshot to newer versions of those accounts, specifically vote accounts
Note: The only relevant changes are in ledger-tool/main.rs, all other changes are from: #8348
Summary of Changes
Hack together some throwaway code to try and achieve above.
Note: Nothing has been tested or even run yet 😛
Fixes #